package index.oop.lessonCode;

public class Student {
    //设计一个标准的javaBean 类
    //1.构造方法  (空参  带参)
    //2.私有化的成员变量 set()/get();
    //3.方法 (特征)

    //属性 年龄 性别 id
    private int age;
    private String gender;
    private int id;

    //get()/set()

    public void setAge(int age){

        if(age>0){
            this.age=age;
        }else {
            System.out.println("age error");
        }

    }
    public int getAge(){
        return age;
    }

    public Student() {
    }

    public Student(int age, String gender, int id) {
        this.age = age;
        this.gender = gender;
        this.id = id;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", gender='" + gender + '\'' +
                ", id=" + id +
                '}';
    }
    public void study(){
        System.out.println("study java");
    }
}
